package com.ruoyi.controller;

import java.util.List;

import com.ruoyi.domain.T12DTO;
import com.ruoyi.common.result.Result;
import com.ruoyi.domain.T12VO;
import com.ruoyi.domain.BulkResponsesDTO;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.domain.T12;
import com.ruoyi.service.IT12Service;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 信息反馈Controller
 *
 * @author ruoyi
 * @date 2024-07-28
 */
@RestController
@RequestMapping("/T12/T12")
public class T12Controller extends BaseController
{
    @Autowired
    private IT12Service t12Service;

    /**
     * 查询信息反馈列表
     */
    @ApiOperation("查询信息反馈列表")
    @PreAuthorize("@ss.hasPermi('T12:T12:list')")
    @GetMapping("/list")
    public TableDataInfo list(T12DTO t12)
    {
        startPage();
        System.out.println(t12);
        List<T12VO> list = t12Service.selectT12V0List(t12);
        return getDataTable(list);
    }

    /**
     * 获取信息反馈详细信息
     */
    @PreAuthorize("@ss.hasPermi('T12:T12:query')")
    @GetMapping(value = "/{f1201}")
    @ApiOperation("详细信息")
    public AjaxResult getInfo(@PathVariable("f1201") Long f1201)
    {
        return success(t12Service.selectT12ByF1201(f1201));
    }

    /**
     * 新增信息反馈
     */
    @PreAuthorize("@ss.hasPermi('T12:T12:add')")
    @Log(title = "信息反馈", businessType = BusinessType.INSERT)
    @PostMapping
    @ApiOperation("新增详细")
    public AjaxResult add(@RequestBody T12 t12)
    {
        return toAjax(t12Service.insertT12(t12));
    }

    /**
     * 修改
     */
    @PreAuthorize("@ss.hasPermi('T12:T12:edit')")
    @Log(title = "信息反馈", businessType = BusinessType.UPDATE)
    @ApiOperation("修改")
    @PutMapping
    public AjaxResult edit(@RequestBody T12 t12)
    {
        System.out.println(t12);
        return toAjax(t12Service.updateT12(t12));
    }

    /**
     * 删除信息反馈
     */
    @PreAuthorize("@ss.hasPermi('T12:T12:remove')")
    @Log(title = "信息反馈", businessType = BusinessType.DELETE)
    @ApiOperation("删除")
	@DeleteMapping("/{f1201s}")
    public AjaxResult remove(@PathVariable Long[] f1201s)
    {
        return toAjax(t12Service.deleteT12ByF1201s(f1201s));
    }

    /**
     * 运营端：批量回复信息接口
     */
    @PutMapping("/bulkResponses")
    public Result<Object> bulkResponses(@RequestBody BulkResponsesDTO bulkResponsesDTO)
    {
        t12Service.bulkResponses(bulkResponsesDTO);
        return Result.success();
    }

    /**
     * 更改为已处理
     * @param bulkResponsesDTO
     * @return
     */
    @PutMapping("/updateStatusProcessed")
    public Result<Object> updateStatusProcessed(@RequestBody BulkResponsesDTO bulkResponsesDTO)
    {
        t12Service.updateStatusProcessed(bulkResponsesDTO);
        return Result.success();
    }
}
